<template>
  <div class="about-box">
    <div class="about-center">
      <span class="about-center-left">
        <p :class="{ 'left-active': cruuent === 3 }" @click="setCruuent(3)">服务协议</p>
        <p :class="{ 'left-active': cruuent === 5 }" @click="setCruuent(5)">隐私政策</p>
      </span>
      <span class="about-content" v-html="textInfo" id="scroll-child-999"> </span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { urls } from '@/utils/request/upload';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { getBanner, contentData } from '@/api/banner/banner';
const textInfo = ref('');
const cruuent = ref(3);
const route = useRoute();
if (route.query.agreeType) {
  cruuent.value = Number(route.query.agreeType);
}
const init = async () => {
  try {
    let { data } = await contentData(cruuent.value);
    textInfo.value = data.data;
    let ele = document.getElementById(`scroll-child-999`);
    ele.scrollIntoView({ behavior: 'smooth', block: 'center' });
    // console.log(data)
  } catch {}
};
const setCruuent = (e: number) => {
  cruuent.value = e;
  init();
};
init();
</script>

<style lang="less" scoped>
.about-box {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  margin-top: 30px;
}
.back-shadow {
  width: 100%;
  height: 100%;
  z-index: 99;
  background: #fbf8f2;
  opacity: 0.4;
}
.about-center {
  position: relative;
  z-index: 999;
  display: flex;
  width: 1180px;
  height: 80vh;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0px 2px 4px 0px rgba(226, 223, 209, 0.38);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  padding: 80px;
  p {
    font-size: 16px;
    line-height: 24px;
  }
}
.about-center-left {
  width: 200px;
  p {
    cursor: pointer;
    padding-left: 40px;
    font-size: 16px;

    font-weight: bold;
    color: #333333;
    line-height: 24px;
    margin-bottom: 30px;
  }
  .left-active {
    border-left: 2px solid #000;
  }
}

.about-content {
  flex: 1;
  overflow: scroll;
}
p {
  font-family: SourceHanSerifCN-Medium, SourceHanSerifCN;
  font-weight: 500;
  color: #333333;
  line-height: 28px;
}
</style>
